<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:p="http://primefaces.org/ui">
	
	<f:metadata>
		<f:event type="preRenderView" listener="#{acceptionMB.initwfm}" />
	</f:metadata>
	
	<p:commandButton value="验收单审核..." type="button" onclick="PF('dlgWfm').show();" />
	
	<p:dialog header="验收单审核" widgetVar="dlgWfm" modal="true"  appendTo="@(body)"  
		dynamic="true" closeOnEscape="true"  height="540" width="1280">
		
	<h:form id="frm1">
		<p:growl id="msgs1" showDetail="true" />
		<p:panel id="contPanel" header="基本信息录入" style="margin-bottom:5px">		
			
			<h:panelGrid columns="10" cellspacing="10" >	
				<p:outputLabel value="项目名称" />
				<p:inputText id="pproject" value="#{acceptionMB.selectedContract.pname}"  readonly="true"  disabled="true"/>
			
				<p:outputLabel value="合同名称" />
				<p:inputText id="pcontract" value="#{acceptionMB.selectedContract.name}"  readonly="true"  disabled="true"/>
				<p:outputLabel value="收货地址" />
				<p:inputText value="#{acceptionMB.selectedContract.shippingAddress}" />	
				
				<p:outputLabel value="供应商" />
				<p:selectOneMenu value="#{acceptionMB.selectedSupplier}" converter="bmeSupplierConverter" 
						effect="fade"  style="width:80%" panelStyle="width:180px" 
                        var="t" filter="true" filterMatchMode="startsWith"
                        required="true" requiredMessage="供应商必须输入" >
                    <p:ajax update=":frm1:psupplier " />     
		            <f:selectItems value="#{acceptionMB.bmeSuppliers}" var="ssupplier" itemLabel="#{ssupplier.id}" itemValue="#{ssupplier}" />
		 
		            <p:column style="width:10%">
		                <h:outputText value="#{t.id}" />
		            </p:column>		 
		            <p:column>
		                <h:outputText value="#{t.name}" />
		            </p:column>        
		        </p:selectOneMenu>	
				<p:outputLabel value="供应商名称" />
				<p:inputText id="psupplier" value="#{acceptionMB.selectedSupplier.name}"  disabled="true"/>			

				<p:outputLabel value="验收单编号" />
				<p:inputText  value="#{acceptionMB.io.id}" required="true" requiredMessage="验收单编号必须输入"/>

				<p:outputLabel value="验收日期" />
				<p:calendar locale="zh" navigator="true"  value="#{acceptionMB.io.acceptDate}" 
					pattern="yyyy-MM-dd" mask="true"  mode="popup"	showOn="button" popupIconOnly="true"
					required="true" requiredMessage="验收日期必须输入" />
				<p:outputLabel value="单据状态" />
				<p:selectOneMenu value="#{acceptionMB.io.status}" effect="fold" style="width:80%;" 
					required="true" requiredMessage="状态必须输入" >
					<f:selectItems value="#{acceptionMB.itemsStatus}" /> 
				</p:selectOneMenu>						
				<p:outputLabel value="备注" />
				<p:inputText value="#{acceptionMB.io.remarks}" />	

			</h:panelGrid>		
				
		</p:panel>

	</h:form>

	<h:form id="frm2">	
		<p:growl id="msgs2" showDetail="true" />
		<p:panel id="mainPanel" header="详细信息录入" style="margin-bottom:5px">
			    			
			<p:dataTable id="rdt" value="#{acceptionMB.vod}"  var="row"  rowIndexVar="rowNum"
				resizableColumns="true" liveResize="true" 
				editable="true"  style="margin-bottom:5px"
				paginator="true" paginatorPosition="bottom" rows="8" 
				emptyMessage="没有记录" >
    
				<p:ajax event="rowEdit" listener="#{acceptionMB.onRowEdit}" 
					update=":frm2:msgs2  " />
				<p:ajax event="rowEditCancel"	listener="#{acceptionMB.onRowCancel}"
					update=":frm2:msgs2" />					
				<p:column headerText="No." width="20" >
					#{rowNum+1}
				</p:column>				
				<p:column headerText="物料编号" sortBy="#{row.bmeMaterial.id}" width="100" >
					<h:outputText value="#{row.bmeMaterial.id}"  />
				</p:column>
				<p:column headerText="物料描述" width="100" >
					<h:outputText value="#{row.bmeMaterial.mdesc}" />
				</p:column>
				<p:column headerText="规格" width="100" >
					<h:outputText value="#{row.speci}" />
				</p:column>				
				<p:column headerText="数量" width="100" >
					<p:cellEditor>
						<f:facet name="output"><h:outputText value="#{row.mquantity}" /></f:facet>
						<f:facet name="input"><p:inputText value="#{row.mquantity}"  /></f:facet>
					</p:cellEditor>
				</p:column>
				<p:column headerText="加工规格" width="100" >
					<h:outputText value="#{row.processSpeci}" />
				</p:column>
				<p:column headerText="数量片" width="100" >
					<p:cellEditor>
						<f:facet name="output"><h:outputText value="#{row.processQuantity}" /></f:facet>
						<f:facet name="input"><p:inputText value="#{row.processQuantity}"  /></f:facet>
					</p:cellEditor>
				</p:column>	
				<p:column headerText="单价" width="100" >
					<p:cellEditor>
						<f:facet name="output"><h:outputText value="#{row.mprice}" /></f:facet>
						<f:facet name="input"><p:inputText value="#{row.mprice}" />
						</f:facet>
					</p:cellEditor>
				</p:column>
				<p:column headerText="金额" width="100" >
					<p:cellEditor>
						<f:facet name="output"><h:outputText value="#{row.amount}" /></f:facet>
						<f:facet name="input"><p:inputText value="#{row.amount}" />
						</f:facet>
					</p:cellEditor>
				</p:column>
				<p:column headerText="备注" width="100" >
					<p:cellEditor>
						<f:facet name="output"><h:outputText value="#{row.remarks}" /></f:facet>
						<f:facet name="input"><p:inputText value="#{row.remarks}" />
						</f:facet>
					</p:cellEditor>
				</p:column>				
				
				<p:column headerText="修改" style="width:32px">
					<p:rowEditor editTitle="修改" cancelTitle="取消" saveTitle="保存" />
				</p:column>
				<p:column headerText="删除" style="width:32px">
					<p:commandButton icon="ui-icon-minus"   title="删除"  immediate="true"
						action="#{acceptionMB.delDetail}" update=":frm2 ">
						<f:setPropertyActionListener value="#{row}"
							target="#{acceptionMB.selectedd}" />
						<p:confirm header="确认" message="你确定删除此记录信息？" icon="ui-icon-alert" />
					</p:commandButton>	
				</p:column>
				
			</p:dataTable>    
		</p:panel>		
	</h:form>	
		
	<!-- confirm to del product -->
    <p:confirmDialog global="true" showEffect="fade" hideEffect="fade">
        <p:commandButton value="确认" type="button" styleClass="ui-confirmdialog-yes" icon="ui-icon-check" />
        <p:commandButton value="取消" type="button" styleClass="ui-confirmdialog-no" icon="ui-icon-close" />
    </p:confirmDialog>
		
		
	</p:dialog> 

</ui:composition>
